package org.jeecg.modules.tt_question_collect.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.jeecg.modules.tt_question_collect.entity.TtAuditRecord;

import java.util.List;
import java.util.Map;

/**
 * @Description: 审核记录表
 * @Author: jeecg-boot
 * @Date:   2021-02-02
 * @Version: V1.0
 */
public interface TtAuditRecordMapper extends BaseMapper<TtAuditRecord> {

	public List<String> queryisnew(@Param("userId") String userId,String lclx);



	public Long queryisqtsh(@Param("tableid") String tableid,@Param("sortid") String sortid,String lclx);

	public Long queryisend(@Param("sortid") String sortid,@Param("tableid") String tableid,String lclx);

	public void updatenew(@Param("sortid") String sortid,String lclx,@Param("tableid") String tableid);

	public void updateotherisnew(@Param("sortid") String sortid, @Param("auditId") String auditId,@Param("lclx")  String lclx, @Param("tableid")  String tableid);

	public void updateothershbj(@Param("tableid") String tableid, @Param("recordId") String recordId, @Param("sortid") String sortid,String lclx);

	@Update("update tt_audit_record set scbj = '1',isnew = '2' where sortid = ${sortid} and  tableid = '${id}' and scbj ='0' and lclx = ${lclx}")
	public void updateothershbjtg(@Param("sortid") String sortid,@Param("id") String id,String lclx);


	@Select("select  nodename,nodetype,auditrange,audituserid,auditusername,isnew,sortid,shbj from tt_audit_record where tableid =  '${tableid}' and scbj ='0' and lclx = ${lclx}")
	public List<Map<String, Object>> getshjl(String tableid,String lclx);


	@Select("select  * from tt_audit_record where tableid =  '${id}' and scbj = '${scbj}' and lclx = '${lclx}' order by sortid asc")
	public List<Map<String, Object>> getlist(String id,String scbj,String lclx);

	@Select("select * from tt_audit_record where tableid = '${questionCode}' and scbj = '0' and isnew = '1'")
	List<TtAuditRecord> queryAuditListByQuestionCode(String questionCode,String lclx);

	@Select("select * from tt_audit_record where tableid = '${questionCode}' and scbj = '0' and shbj = '2' and isnew = '2'")
	TtAuditRecord queryAuditBackListByQuestionCode(String questionCode,String lclx);

	@Update("update tt_audit_record set shbj ='1',isnew ='2'  where tableid= '${id}' and lclx = '${lclx}'")
	public void upatefazt(@Param("id") String id, @Param("lclx")String lclx);

	@Select("select flowcode from tt_collect_flow where by1 = '${proname}' ")
    String getflowid(String proname);
}
